package com.whmall.service.crm.provider;

import com.whmall.component.entity.dto.PageReqDTO;
import com.whmall.component.entity.dto.PageRspDTO;
import com.whmall.service.crm.api.CompanyUserErrorCorrectionApi;
import com.whmall.service.crm.entity.dto.companyusererrorcorrection.CorrectionDTO;
import com.whmall.service.crm.entity.dto.companyusererrorcorrection.CorrectionListDTO;
import com.whmall.service.crm.entity.dto.companyusererrorcorrection.CorrectionQueryDTO;
import com.whmall.service.crm.module.companyusererrorcorrection.entry.qo.CorrectionQO;
import com.whmall.service.crm.module.companyusererrorcorrection.service.CompanyUserErrorCorrectionService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author qiao shengda
 * @since 2021/5/27
 */
@Service
public class CompanyUserErrorCorrectionProvider implements CompanyUserErrorCorrectionApi {

    @Autowired
    private CompanyUserErrorCorrectionService companyUserErrorCorrectionService;

    @Override
    public PageRspDTO<CorrectionListDTO> page(PageReqDTO pageReqDTO, CorrectionQueryDTO correctionQueryDTO) {
        CorrectionQO qo = new CorrectionQO();
        BeanUtils.copyProperties(correctionQueryDTO, qo);
        return companyUserErrorCorrectionService.page(pageReqDTO, qo);
    }


    @Override
    public int response(Long id, String content) {
        return companyUserErrorCorrectionService.response(id, content);
    }

    @Override
    public PageRspDTO<CorrectionDTO> pageByUserId(PageReqDTO pageReqDTO, Long userId) {
        return companyUserErrorCorrectionService.pageByUserId(pageReqDTO, userId);
    }

    @Override
    public int save(Long userId, Long chemicalId, String content) {
        return companyUserErrorCorrectionService.save(userId, chemicalId, content);
    }

    @Override
    public int remove(Long id, Long userId) {
        return companyUserErrorCorrectionService.remove(id, userId);
    }
}
